package com.cn.dao;

import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.List;

import com.cn.conn.DataManager;
import com.cn.conn.RowDatas;
import com.cn.entity.Stores_entity;

/**
 * 门店信息实体类
 * @author N1ckeyHouse
 *
 */
public class Stores_DAO extends DataManager{
	private RowDatas<Stores_entity> stores;
	
	public Stores_DAO() {
		stores = new Stores();
	}
	
	public List<Stores_entity> getStores(){
		String sql = "SELECT a.id,a.service_fee,"
				+ "a.store_address,a.store_district,"
				+ "a.store_image,a.store_name,"
				+ "a.store_phone,a.store_tradingArea,"
				+ "a.store_type,a.susiness_hours "
				+ "FROM tb_store a";
		
		return queryList(sql, stores);
	}
	
	private class Stores implements RowDatas<Stores_entity>{
		@Override
		public Stores_entity getRowData(ResultSet rs) throws SQLException {
			Stores_entity store = new Stores_entity();
			store.setStore_id(rs.getInt("id"));
			store.setStore_image(rs.getInt("store_image"));
			store.setStore_serviceFee(rs.getInt("service_fee"));
			store.setStore_name(rs.getString("store_name"));
			store.setStore_address(rs.getString("store_address"));
			store.setStore_phone(rs.getString("store_phone"));
			store.setStore_susinessHours(rs.getString("susiness_hours"));
			store.setStore_district(rs.getString("store_district"));
			store.setStore_tradingArea(rs.getString("store_tradingArea"));
			store.setStore_type(rs.getString("store_type"));
			
			return store;
		}
	}
}
